package com.xyz.admin.config;


import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.context.ApplicationListener;
import org.springframework.context.event.ContextRefreshedEvent;
import org.springframework.stereotype.Component;

@Component
public class StartedEventListener implements ApplicationListener<ContextRefreshedEvent> {

    private static final Logger logger = LoggerFactory.getLogger(StartedEventListener.class);

    @Override
    public void onApplicationEvent(ContextRefreshedEvent event) {
        if(AppDataContext.getContext() == null){
            AppDataContext.setApplicationContext(event.getApplicationContext());
            logger.info("StartedEventListener ok...");
        }
    }
}
